<!DOCTYPE HTML>
<html lang="zxx">

<head>
	<title>Home</title>
	<!-- Meta tag Keywords -->
	<meta name="viewport" content="width=device-width, initial-scale=1">
	<meta charset="UTF-8" />
	<meta name="keywords" content=""/>

	<!-- Meta tag Keywords -->
	<!-- css files -->
	<link rel="stylesheet" href="/static/sm_assets/css/loginstyle.css" type="text/css" media="all" />
	<!-- Style-CSS -->
	<link rel="stylesheet" href="/static/sm_assets/css/fontawesome-all.css">
	<!-- Font-Awesome-Icons-CSS -->
	<!-- //css files -->
	<!-- web-fonts -->
	<link href="http://maxcdn.bootstrapcdn.com/css?family=Josefin+Sans:100,100i,300,300i,400,400i,600,600i,700,700i" rel="stylesheet">
	<link href="http://maxcdn.bootstrapcdn.com/css?family=Open+Sans:300,300i,400,400i,600,600i,700,700i,800,800i" rel="stylesheet">
	<!-- //web-fonts -->
</head>

<body>
	<!-- bg effect -->
	<div id="bg">
		<canvas></canvas>
		<canvas></canvas>
		<canvas></canvas>
	</div>
	<!-- //bg effect -->
	<!-- title -->
	<h1>超市分部登录</h1>
	<!-- //title -->
	<!-- content -->
	<div class="sub-main-w3">
		<form  onsubmit="return false;">
			<h2>Login Now
				<i class="fas fa-level-down-alt"></i>
			</h2>
			<div class="form-style-agile">
				<label>
					<i class="fas fa-user"></i>
					用户名
				</label>
				<input id="id" placeholder="Username" name="id" type="text" required="" maxlength="50">
			</div>
			<div class="form-style-agile">
				<label>
					<i class="fas fa-unlock-alt"></i>
					密码
				</label>
				<input id="password" placeholder="Password" name="password" type="password" required="" maxlength="50">
			</div>
			<!-- checkbox -->
			<div class="wthree-text">
				<ul>
					<li>
						<span id="error"></span>
					</li>
				</ul>
			</div>
			<!-- //checkbox -->
			<input id="submit" type="submit" value="登录">
			<!-- <button id="submit">登录</button> -->
					
		</form>

	</div>
	<!-- //content -->

	<!-- copyright -->
	<div class="footer">
		<p>Copyright &copy; 2020 </p>
	</div>
	<!-- //copyright -->

	<!-- Jquery -->
	<script src="/static/sm_assets/js/jquery.min.js"></script>
	<!-- //Jquery -->

	<!-- effect js -->
	<script src="/static/sm_assets/js/canva_moving_effect.js"></script>
	<!-- //effect js -->
<script>
		addEventListener("load", function () {
			setTimeout(hideURLbar, 0);
		}, false);

		function hideURLbar() {
			window.scrollTo(0, 1);
		};

	    $('#submit').click(function(){
	         $.ajax({
	             type: "POST",
	             url: "/juniorAdmin/authenticate/",
	             data: {
	             	'id':$("#id").val(),
	             	'password':$("#password").val(),
	             },
	             dataType: "json",
	             success: function (data) {

                    if (data.user){
                        location.assign('/juniorAdmin/')

                    }else {
                        $("#error").html(data.message).css({'color':'red','margin-left':'20px'})
                    }
                }
                
	         });
	         return false;
	    })
	</script>
</body>

</html>